﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using YBApproval.Model;

namespace YBApproval.EFDAL
{
    public class YBDbContext : DbContext
    {
        public DbSet<Field> Fields { get; set; }
        public DbSet<OptionListItem> OptionListItems { get; set; }
        public DbSet<OptionList> OptionLists { get; set; }
        public DbSet<InstanceValue> InstanceValues { get; set; }
        public DbSet<Instance> Instances { get; set; }
        public DbSet<InstanceApproval> InstanceApprovals { get; set; }
        public DbSet<Approval> Approvals { get; set; }
        public DbSet<Node> Nodes { get; set; }
        public DbSet<Process> Processes { get; set; }
        public DbSet<Form_ProcessSet> Form_ProcessSets { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<UserProfile> UserProfiles { get; set; }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            //modelBuilder.Entity<Field>().HasRequired(p => p.FieldOptionList).WithOptional();
            base.OnModelCreating(modelBuilder);
        }
    }
}
